<template>
  <div class="page">
    <h1>{{blog.title}}</h1>
    <article>{{blog.content}}</article>
    <p>作者：{{blog.author}}</p>
    <p>分类：</p>
    <ul>
      <li
        v-for="(category, index) in blog.categories"
        :key="index"
        style="display:inline"
      >{{category}}</li>
    </ul>
  </div>
</template>

<script type="text/ecmascript-6">
import axios from "axios";
export default {
  data() {
    return {
      id: this.$route.params.id,
      blog: {}
    };
  },
  components: {},
  created() {
    axios
      .get("https://wd9328603459zdqdne.wilddogio.com/blog/" + this.id + ".json")
      .then(res => (this.blog = res.data));
  }
};
</script>

<style scoped>
.page {
  max-width: 800px;
  margin: 0 auto;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-top: 20px;
  background-color: #fcfcfc;
}
h1 {
  line-height: 34px;
  font-size: 38px;
}
li {
  list-style: none;
}
</style>
